home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / m68k / cc68k.arc / SYMBOL.C < prev   
C/C++ Source or Header  |  1986-10-26  |  2KB  |  61 lines

  1. #include        "stdio.h"
  2. #include        "string.h"
  3. #include        "c.h"
  4. #include        "expr.h"
  5. #include        "gen.h"
  6. #include        "cglbdec.h"
  7.  
  8. /*
  9.  *    68000 C compiler
  10.  *
  11.  *    Copyright 1984, 1985, 1986 Matthew Brandt.
  12.  *  all commercial rights reserved.
  13.  *
  14.  *    This compiler is intended as an instructive tool for personal use. Any
  15.  *    use for profit without the written consent of the author is prohibited.
  16.  *
  17.  *    This compiler may be distributed freely for non-commercial use as long
  18.  *    as this notice stays intact. Please forward any enhancements or question
  19. s
  20.  *    to:
  21.  *
  22.  *        Matthew Brandt
  23.  *        Box 920337
  24.  *        Norcross, Ga 30092
  25.  */
  26.  
  27. SYM     *search(na,thead)
  28. char    *na;
  29. SYM     *thead;
  30. {       while( thead != 0) {
  31.                 if(strcmp(thead->name,na) == 0)
  32.                         return thead;
  33.                 thead = thead->next;
  34.                 }
  35.         return 0;
  36. }
  37.  
  38. SYM     *gsearch(na)
  39. char    *na;
  40. {       SYM     *sp;
  41.         if( (sp = search(na,lsyms.head)) == 0)
  42.                 sp = search(na,gsyms.head);
  43.         return sp;
  44. }
  45.  
  46.  insert(sp,table)
  47. SYM     *sp;
  48. TABLE   *table;
  49. {       if( search(sp->name,table->head) == 0) {
  50.                 if( table->head == 0)
  51.                         table->head = table->tail = sp;
  52.                 else    {
  53.                         table->tail->next = sp;
  54.                         table->tail = sp;
  55.                         }
  56.                 sp->next = 0;
  57.                 }
  58.         else
  59.                 error(ERR_DUPSYM);
  60. }
  61.